<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAdminsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('admins', function (Blueprint $table) {
            $table->id();
            $table->string('username', 50)->unique()->comment('管理员用户名');
            $table->string('name', 100)->comment('管理员姓名');
            $table->string('email', 100)->unique()->nullable()->comment('电子邮箱');
            $table->string('password')->comment('密码');
            $table->string('avatar', 255)->nullable()->comment('头像');
            $table->string('remember_token', 100)->nullable();
            $table->boolean('is_super_admin')->default(false)->comment('是否超级管理员');
            $table->boolean('is_active')->default(true)->comment('是否激活');
            $table->timestamp('last_login_at')->nullable()->comment('最后登录时间');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('admins');
    }
}
